﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package net.wooga.pets.controllers {
    import net.wooga.pets.events.*;
    import net.wooga.pets.constants.*;
    import org.robotlegs.mvcs.*;

    public class HandleErrorCommand extends Command {

		[Inject]
        public var event:InfoEvent;

        override public function execute():void{
            var _local1:int = int(this.event.info);
            switch (this.event.type){
                case EventConstants.ON_LOAD_ERROR:
                    this.handleLoadError(_local1);
                    break;
            };
        }
        private function handleLoadError(_arg1:int):void{
            switch (_arg1){
                case 403:
                    this.enforceReload("global_errormessage_newversion", "global_errormessage_newversion_text", "HappyHamster");
                    break;
                case 404:
                    this.enforceReload("global_errormessage_header", "global_error_message", "SadWaschiBaby");
                    break;
            };
        }
        private function enforceReload(_arg1:String, _arg2:String, _arg3:String):void{
            var _local4:Object = {header:_arg1, body:_arg2, clip:_arg3};
            var _local5:InfoEvent = new InfoEvent(EventConstants.CREATE_POPUP, GameConstants.ENFORCE_RELOAD_POPUP, _local4);
            dispatch(_local5);
        }

    }
}//package net.wooga.pets.controllers 
